package com.hollycrm.hollysqm.util;

/**
 * 常量类
 * @author jianglong
 * @date 2017年2月22日 下午3:20:37
 */
public class Constant {
	
	public final static String CREATE_V8_INDEX_JOB = "createV8IndexJob";//V8
	public final static String CREATE_I8_INDEX_JOB = "createI8IndexJob";//I8
	public final static String SYNCHRO_I8_DB_JOB = "synchroI8DbJob";
	
	public final static String V8 = "v8";
	public final static String I8 = "i8";
	public final static String EXECUTION="execution";//执行中
	public final static String SUCCESS="success";//成功
	public final static String FAIL="fail";//失败

	public final static int INDEX_CIRCLE_COUNT = 3;//重复执行的次数
	
	public final static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";//时间格式
	public final static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";//时间格式
	public final static String YYYYMMDD = "yyyyMMdd";//日期格式
	public final static String YYYY_MM_DD = "yyyy-MM-dd";//日期格式
	
	/**
	 * synchroJob 常量
	 */
    public final static String JOB_SYNCHRO_CUSTCONTINFO = "CUSTCONTINFO"; //客户接触记录表标识
    public final static String JOB_SYNCHRO_RECOINFO = "RECOINFO"; //录音记录信息
    public final static String JOB_SYNCHRO_SEREQUEST = "SEREQUEST"; //服务请求表标识
    
    /**
     * V8常量类
     */
    public static final String id="id";//主键
    public final static String serviceType = "serviceType";
    public final static String custcontinfoId = "custcontinfoId";
    public final static String txtContentUser = "txtContentUser";
    public final static String txtContentAgent = "txtContentAgent";
    public final static String txtContent = "txtContent";    
	public final static String allContent="txtContent";//全部文本
	public final static String acceptTime="acceptTime";//来电开始时间
    public final static String satisfication_v8 = "satisfication";
    public final static String satisfication_i8 = "satisfaction";
    public final static String businessType = "businessType";
    public final static String areaCode = "areaCode";
    public final static String callee = "callee";
    public final static String caller = "caller";
    public final static String day = "day";
    public final static String mobileNo = "mobileNo";
    public final static String custArea = "custArea";
    public final static String custBand = "custBand";
    public final static String custLevel = "custLevel";
    public final static String recoinfoLength = "recoinfoLength";
    public final static String silenceLength = "silenceLength";
    public final static String userCode = "userCode";
    public final static String agentCode = "agentCode";
    public final static String recordLengthRange = "recordLengthRange";
    public final static String silenceLengthRange = "silenceLengthRange";
	public final static String hangupFlag = "hangupFlag";
    public final static String age = "age";
    public final static String sex = "sex";
    public final static String workAge = "workAge";
    public final static String direction = "direction";
    public final static String hasSolved = "hasSolved";
    public final static String callFlag = "callFlag";
    public final static String passwordCheck = "passwordCheck";
    public final static String netAge = "netAge";


    /**
     * I8常量类
     */
    public final static String closeType = "closeType";
    public final static String sessionLength = "sessionLength";
    public final static String sessionType = "sessionType";
    public final static String contactTime = "contactTime";
    public final static String caller_v8 = "caller";
    public final static String caller_i8 = "phone";    
    /**
     * 返回符合Solr查询日期段的条件格式字段串
     * @param sDate
     * @param eDate
     * @return
     */
    public static String getAssemble(String sDate,String eDate){
    	return String.format("[%s TO %s]", sDate, eDate);
    }
    
    /**
     * 求取录音时长区间 根据常用编码"RECOINFO_LENGTH"
     * @param time
     * @return
     */
    public static String getRecoinfoLengthRangeCode(long time){
        int length = (int) Math.ceil(time / (double) 1000);
        if(length<=35)return "01";
        if(length<=95 && length>35)return "02";
        if(length<=180 && length > 95)return "03";
        if(length<=300 && length>180)return "04";
        if(length>300)return "05";
        return "unKnow";
    }
    /**
     * 获取静音区间 编码”SILENCE_LENGTH“
     * @param recoinfoLength
     * @param silenceLength
     * @return
     */
    public static String getSilenceRangeCode(long recoinfoLength,long silenceLength){
        if(recoinfoLength==0)return "unKnow";
        double r=silenceLength/(double)recoinfoLength;
        if(r<=0.4)return "1";
        else return "2";
    }
	
}
